package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.entity.FollowListEntity;
import com.zw.yzk.kabu.model.MyFollowModel;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/3/4.
 */

public class FollowListMapper {

    @Inject
    public FollowListMapper() {

    }

    public MyFollowModel transfer(FollowListEntity.Follow follow) {
        MyFollowModel model = new MyFollowModel();
        model.setHead(follow.head);
        model.setName(follow.nickName);
        model.setIntroduction(follow.introduction);
        model.setId(follow.followId);
        model.setConcerned(follow.followState);// 0:未关注 1:已关注 2:已被对方关注 3:互粉

        return model;
    }

    public List<MyFollowModel> transfer(FollowListEntity entity) {
        List<MyFollowModel> models = new ArrayList<>();
        if(entity.result.followList == null || entity.result.followList.isEmpty()) {
            return models;
        }
        for(FollowListEntity.Follow follow : entity.result.followList) {
            models.add(transfer(follow));
        }

        return models;
    }
}
